package com.transport.analysis.traffic;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class IntPairWritable implements Writable {
    private int first;
    private int second;

    public IntPairWritable() {
    }

    public IntPairWritable(int first, int second) {
        this.first = first;
        this.second = second;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeInt(first);
        out.writeInt(second);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        first = in.readInt();
        second = in.readInt();
    }

    public int getFirst() {
        return first;
    }

    public void setFirst(int first) {
        this.first = first;
    }

    public int getSecond() {
        return second;
    }

    public void setSecond(int second) {
        this.second = second;
    }

    public void set(int left, int right) {
        this.first = left;
        this.second = right;
    }

    public int getLeft() {
        return this.first;
    }

    public int getRight() {
        return this.second;
    }

    @Override
    public String toString() {
        return first + "\t" + second;
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return super.equals(obj);
    }
}